<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // counter = {}
      function counter() {
        counter.age = 20;
        counter.num = 100;
        counter.say();
      }
      counter.num = 0;
      counter.say = function () {
        console.log(this.num);
      };
      counter(); //重要
      counter.say();
      console.log(counter.age);
    </script>
  </body>
</html>
